package ldh.im.fxbase.data.pojo.status;

import ldh.im.dto.enums.LabelStatus;
import ldh.im.dto.enums.ModuleItemStatus;
import ldh.rpc.dto.ValueEnum;

public enum ImModuleItemStatus implements ValueEnum<Byte> {
    enable(1,"可用"),
    disable(2,"不可用"),
    ;

    private Byte value;
    private String desc;

    private ImModuleItemStatus(Integer value, String desc) {
        this.value = value.byteValue();
        this.desc = desc;
    }

    @Override
    public Byte getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }


    public static ImModuleItemStatus getByValue(Integer value) {
        if (value == null) return null;
        for (ImModuleItemStatus labelStatus : ImModuleItemStatus.values()) {
            if (labelStatus.getValue() == value.byteValue()) {
                return labelStatus;
            }
        }

        throw new RuntimeException("ImModuleStatus不支持这个值：" + value);
    }

    public static ImModuleItemStatus wrap(ModuleItemStatus status) {
        if (status == ModuleItemStatus.enable) {
            return enable;
        } else if (status == ModuleItemStatus.disable) {
            return disable;
        }
        throw new RuntimeException("ImModuleStatus不支持这个值：" + status);
    }
}